package com.hmall.api.item;

import com.hmall.api.item.dto.ItemDTO;
import com.hmall.api.item.dto.OrderDetailDTO;
import com.hmall.api.item.fallback.ItemClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;

/**
 * 商品服务Feign接口
 *
 * @Author mr.zhao
 * @Date 2025/6/17 19:27
 */
@FeignClient(name = "item-service",path = "/items",fallbackFactory = ItemClientFallbackFactory.class)
public interface ItemClient {

	@GetMapping
	List<ItemDTO> queryItemByIds(@RequestParam("ids") Collection<Long> ids);

	@PutMapping("/stock/deduct")
	public void deductStock(@RequestBody List<OrderDetailDTO> items);

	@PutMapping("/stock/rollback")
	public void rollbackStock(@RequestBody OrderDetailDTO dto);
}
